/*
 * comport.c
 *
 *  Created on: Jul 4, 2023
 *      Author: ASUS
 */


#include "my_inc.h"


static uint8_t  send_buffer[uart2_send_len] = {0x00};
static uint8_t  recv_buffer[uart2_recv_len]   = {0x00};


static void send_array(uint8_t*,uint16_t);  //串口发送数组
static void send_string(uint8_t*);          //串口发送字符串


uart_t uart2 =
{
	send_buffer,
	recv_buffer,
	//huart,            //串口处理句柄

	send_array,
	send_string
};



/*
	* @name   send_array
	* @brief  串口发送数组
	* @param  p_arr:数组首地址，len:发送长度
*/
static void send_array(uint8_t* p_arr,uint16_t len)
{
	HAL_UART_Transmit(&huart2, p_arr, len, 8);

}



/*
	* @name   send_string
	* @brief  发送字符串
	* @param  p_str:待发送字符串
*/

static void send_string(uint8_t* p_str)
{
	//memset(uart2.recv_buffer, 0, uart2_recv_len);
	HAL_UART_Transmit(&huart2, p_str, strlen((const char*)p_str), 8);
	//printf("send strlen:%d\r\n", strlen((const char*)p_str));
}



